#! /usr/bin/python


import gtk		# for GUI
import webbrowser	# for opening web-pages

paragraph = "You've tried to open a program which was written for the Microsoft Windows family of operating systems.\nThis software cannot be opened by Ubuntu.\n\nHowever, you can install a program called Wine, which may allow you to run this program.\n\nIf you choose to install Wine please bear in mind that your Microsoft Windows software is not guarenteed to run.\n\nYou can install Wine now, or visit the website to find out more."

infoURL = 'http://www.winehq.org/about/'
wineURL = 'apt:wine'

class WineInstaller(gtk.Window):
    def __init__ (self):
        super (WineInstaller, self).__init__()
        
        self.set_title		("Microsoft Windows Software")
        self.set_position	(gtk.WIN_POS_CENTER)
        self.connect		("destroy", gtk.main_quit)
        self.set_border_width	(8)
       # self.set_default_size	(100, 100)
        
        vbox	= gtk.VBox	(False, 10)
        hbox	= gtk.HBox	(True, 5)
        valign	= gtk.Alignment	(0, 1, 0, 0)
	
        
        button_cancel   = gtk.Button	("End Installation")
        button_info     = gtk.Button	("More Information")
        button_install  = gtk.Button	("Install Wine Now")      
        label_text	= gtk.Label	(paragraph)
        
        label_text.set_line_wrap(True)
        label_text.set_size_request(360, -1)
        
        button_cancel.connect	("clicked", self.quit)
        button_info.connect	("clicked", self.moreInfo)
        button_install.connect	("clicked", self.installWine)
        
        vbox.pack_start(valign)
	
	valign.add (label_text)
        hbox.add (button_cancel)
        hbox.add (button_info)
	hbox.add (button_install)

	halign	= gtk.Alignment (1, 0, 0, 0)
        halign.add		(hbox)
	vbox.pack_start		(halign, False, False, 3)
        
        self.add (vbox)
        self.show_all ()
                    
      
        
    def quit (self, widget):
        exit (0)
    
    def moreInfo (self, widget):
    	self.iconify ()
    	webbrowser.open (infoURL, new=1, autoraise=True)
    	
    def installWine (self, widget):
    	webbrowser.open (wineURL, new=1, autoraise=True)
    	exit (0)
   
WineInstaller ()
gtk.main ()
